package cn.hcbycloud.stream.front;

import cn.hcbycloud.common.mvc.annotation.IgnoreResponseAdvice;
import cn.hcbycloud.stream.dto.StreamMessageDTO;
import cn.hcbycloud.stream.service.SendMessageProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gaoh
 * @desc 构建消息驱动
 * @date 2022年02月11日 下午 10:04
 */
@Slf4j
@RestController
@RequestMapping("/message")
public class MessageController {
    @Autowired
    private SendMessageProducer sendMessageProducer;

    /**
     * 发送消息
     */
    @IgnoreResponseAdvice
    @GetMapping(value = "sendSaveOrderMessage")
    public void sendSaveOrderMessage() {
        //发送消息
        sendMessageProducer.sendMsg(StreamMessageDTO.defaultMessage());
        log.info("发送消息成功");
    }
}